package com.jiangyg.mall.member.config;

import com.jiangyg.mall.core.utils.Logger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 类描述：会员服务 RabbitMQ 配置
 *
 * @author jiangyg
 * @date 2022-12-17
 */
@Slf4j
@Configuration
public class MemberRabbitConfiguration implements InitializingBean {

    // TODO 实现监听

    /**
     * 功能描述：声明订单完成会员队列
     * <p>一般用来增加积分等服务</p>
     *
     * @return 订单完成会员
     */
    @Bean
    public Queue orderFinishUserQueue() {
        return new Queue("order.finish.member.queue", true, false, false, null);
    }

    @Override
    public void afterPropertiesSet() {
        Logger.info(log, () -> "[项目启动]-初始化会员服务的 RabbitMQ 配置……");
    }

}
